// ----------------------------------------------------------------------------
// Copyright 2006, Martin D. Flynn
// All rights reserved
// ----------------------------------------------------------------------------
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// 
// http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// ----------------------------------------------------------------------------
// Description:
//  OpenDMTP protocol client error constants.
// ----------------------------------------------------------------------------
// Change History:
//  2006/03/26  Martin D. Flynn
//      Initial release
// ----------------------------------------------------------------------------
package org.opendmtp.j2me.codes;

/**
 * Contains OpenDMTP protocol client error constants.
 * 
 * @author Martin D. Flynn
 * @author Robert Puckett
 */
public interface ClientErrors {

  // ----------------------------------------------------------------------------
  // Protocol/Packet errors (data provides specifics):

  /**
   * Contains an error constant signifying a protocol/packet error for when there is an invalid
   * packet header. <br>
   * Payload:<br>
   * 0:2 - This error code <br>
   * 2:1 - Packet header causing error (if available) <br>
   * 3:1 - Packet type causing error (if available) <br>
   * Notes: Sent to server when the packet header is not recognized.
   */
  public static final int ERROR_PACKET_HEADER = 0xF111;

  /**
   * Contains an error constant signifying a protocol/packet error for when there is an invalid
   * packet type. <br>
   * Payload: <br>
   * 0:2 - This error code <br>
   * 2:1 - Packet header causing error <br>
   * 3:1 - Packet type causing error <br>
   * Notes: Sent to server when the packet type is not recognized.
   */
  public static final int ERROR_PACKET_TYPE = 0xF112;

  /**
   * Contains an error constant signifying a protocol/packet error for when there is an invalid
   * packet length. <br>
   * Payload: <br>
   * 0:2 - This error code <br>
   * 2:1 - Packet header causing error (if available) <br>
   * 3:1 - Packet type causing error (if available) <br>
   * Notes: <br>
   * Sent to server when the packet length is invalid.
   */
  public static final int ERROR_PACKET_LENGTH = 0xF113;

  /**
   * Contains an error constant signifying a protocol/packet error for when there is an
   * invalid/unsupported packet encoding. <br>
   * Payload: <br>
   * 0:2 - This error code <br>
   * 2:1 - Packet header causing error <br>
   * 3:1 - Packet type causing error <br>
   * Notes: <br>
   * Sent to server when the packet encoding is not supported by the client.
   */
  public static final int ERROR_PACKET_ENCODING = 0xF114;

  /**
   * Contains an error constant signifying a protocol/packet error for when there is an invalid
   * packet payload. <br>
   * Payload: <br>
   * 0:2 - This error code <br>
   * 2:1 - Packet header causing error <br>
   * 3:1 - Packet type causing error <br>
   * Notes: <br>
   * Sent to server when the packet payload is invalid.
   */
  public static final int ERROR_PACKET_PAYLOAD = 0xF115;

  /**
   * Contains an error constant signifying a protocol/packet error for when there is an invalid
   * packet checksum (ASCII encoding only). <br>
   * Payload: <br>
   * 0:2 - This error code <br>
   * 2:1 - Packet header causing error <br>
   * 3:1 - Packet type causing error <br>
   * Notes: <br>
   * Sent to server when the packet checksum appears to be invalid. <br>
   * This can only occur for ASCII encoded packets.
   */
  public static final int ERROR_PACKET_CHECKSUM = 0xF116;

  /**
   * Contains an error constant signifying a protocol/packet error for when the packet ACK sequence
   * is invalid. <br>
   * Payload: <br>
   * 0:2 - This error code <br>
   * 2:1 - Packet header causing error <br>
   * 3:1 - Packet type causing error <br>
   * Notes: <br>
   * Sent to server when the packet ACK sequence number was not found <br>
   * in the list of sent/unacknowledged event packets.
   */
  public static final int ERROR_PACKET_ACK = 0xF117;

  /**
   * Contains an error constant signifying a protocol/packet error for when there is an a protocol
   * error. <br>
   * Payload: <br>
   * 0:2 - This error code <br>
   * 2:1 - Packet header causing error <br>
   * 3:1 - Packet type causing error <br>
   * Notes: <br>
   * Sent to server when the client does not receive an expected <br>
   * response from the server.
   */
  public static final int ERROR_PROTOCOL_ERROR = 0xF121;

  // ----------------------------------------------------------------------------
  // Property errors (data provides specifics):

  /**
   * Contains an error constant signifying a property error for when a property is read-only. <br>
   * Payload: <br>
   * 0:2 - This error code <br>
   * 2:2 - the id of the read-only property <br>
   * Notes: <br>
   * Sent to server when an attempt is made to set a read-only property
   */
  public static final int ERROR_PROPERTY_READ_ONLY = 0xF201;

  /**
   * Contains an error constant signifying a property error for when a property is write-only. <br>
   * Payload: <br>
   * 0:2 - This error code <br>
   * 2:2 - the id of the write-only property <br>
   * Notes: <br>
   * Sent to server when an attempt is made to read a write-only property
   */
  public static final int ERROR_PROPERTY_WRITE_ONLY = 0xF202;

  /**
   * Contains an error constant signifying a property error for an invalid/unsupported property ID.
   * <br>
   * Payload: <br>
   * 0:2 - This error code <br>
   * 2:2 - the id of the unrecognized property <br>
   * Notes: <br>
   * Sent to server when an attempt is made to get/set an unrecognized property id
   */
  public static final int ERROR_PROPERTY_INVALID_ID = 0xF211;

  /**
   * Contains an error constant signifying a property error for an invalid property value. <br>
   * Payload: <br>
   * 0:2 - This error code <br>
   * 2:2 - the id of the property which is attempting to be get/set <br>
   * Notes: <br>
   * Sent to server when a specified value is invalid for the property type
   */
  public static final int ERROR_PROPERTY_INVALID_VALUE = 0xF212;

  /**
   * Contains an error constant signifying a property error for an invalid property value. <br>
   * Payload: <br>
   * 0:2 - This error code <br>
   * 2:2 - the id of the property which has the error <br>
   * Notes: <br>
   * Sent to server when a specified value is invalid for the property type
   */
  public static final int ERROR_PROPERTY_UNKNOWN_ERROR = 0xF213;

  // ----------------------------------------------------------------------------
  // Command errors (data provides specifics):

  /**
   * Contains an error constant signifying a command error for when the specified command is
   * invalid/unsupported. <br>
   * Payload: <br>
   * 0:2 - This error code <br>
   * 2:2 - the id of the invalid command. <br>
   * Notes: <br>
   * Sent to the server when the client is requested to perform a <br>
   * command which it does not support.
   */
  public static final int ERROR_COMMAND_INVALID = 0xF311;

  /**
   * Contains an error constant signifying a command error for when the command arguments are
   * invalid, or an execution error was encountered. <br>
   * Payload: <br>
   * 0:2 - This error code <br>
   * 2:2 - the id of the command which had the error <br>
   * 4:2 - returned command error (reason) <br>
   * 6:X - other data which may be useful in diagnosing the error [optional] <br>
   * Notes: <br>
   * Sent to the server when the executed client command has found an <br>
   * error either in the command arguments, or in the execution of the command.
   */
  public static final int ERROR_COMMAND_ERROR = 0xF321;

  // ----------------------------------------------------------------------------
  // Upload errors (data provides specifics):

  /**
   * Contains an error constant signifying an upload error for an invalid specified upload type.
   * <br>
   * Payload: <br>
   * 0:2 - This error code <br>
   * Notes: <br>
   * Sent to the server when the upload record type is not recognized.
   */
  public static final int ERROR_UPLOAD_TYPE = 0xF401;

  /**
   * Contains an error constant signifying an upload error for an invalid specified upload file size (too small/large). <br>
   * Payload: <br>
   * 0:2 - This error code <br>
   * Notes: <br>
   * Sent to the server when the specified data length is too large/small.
   */
  public static final int ERROR_UPLOAD_LENGTH = 0xF411;

  /**
   * Contains an error constant signifying an upload error for an invalid specified upload file
   * offset for overlap. <br>
   * Payload: <br>
   * 0:2 - This error code <br>
   * Notes: <br>
   * Sent to the server when the specified data offset overlaps a previous record.
   */
  public static final int ERROR_UPLOAD_OFFSET_OVERLAP = 0xF412;

  /**
   * Contains an error constant signifying an upload error for an invalid specified upload file
   * offset for gap. <br>
   * Payload: <br>
   * 0:2 - This error code <br>
   * Notes: <br>
   * Sent to the server when the specified data offset leaves a gap between this <br>
   * and the previous record.
   */
  public static final int ERROR_UPLOAD_OFFSET_GAP = 0xF413;

  /**
   * Contains an error constant signifying an upload error for an invalid specified upload file
   * offset. <br>
   * Payload: <br>
   * 0:2 - This error code <br>
   * Notes: <br>
   * Sent to the server when the specified data offset and the length of the <br>
   * provided data exceeds the previously specified length of the file.
   */
  public static final int ERROR_UPLOAD_OFFSET_OVERFLOW = 0xF414;

  /**
   * Contains an error constant signifying an upload error for an invalid specified upload file
   * name. <br>
   * Payload: <br>
   * 0:2 - This error code <br>
   * Notes: <br>
   * Sent to the server when the specified filename is invalid.
   */
  public static final int ERROR_UPLOAD_FILE_NAME = 0xF421;

  /**
   * Contains an error constant signifying an upload error for an invalid specified upload checksum.
   * <br>
   * Payload: <br>
   * 0:2 - This error code <br>
   * Notes: <br>
   * Sent to the server when the specified checksum value is invalid.
   */
  public static final int ERROR_UPLOAD_CHECKSUM = 0xF431;

  /**
   * Contains an error constant signifying an upload error for an error saving upload file. <br>
   * Payload: <br>
   * 0:2 - This error code <br>
   * 2:X - Additional diagnostic information as needed. <br>
   * Notes: <br>
   * Sent to the server when the client is unable to save the uploaded <br>
   * file. Possibly due to some internal client error.
   * 
   */
  public static final int ERROR_UPLOAD_SAVE = 0xF441;

  // ----------------------------------------------------------------------------
  // GPS errors (data provides specifics):

  /**
   * Contains an error constant signifying a GPS error for when a GPS fix has expired (possible
   * antenna problem). <br>
   * Payload: <br>
   * 0:2 - This error code <br>
   * 2:4 - the time of the last valid fix <br>
   * Notes: <br>
   * Sent to server when the client has determined that a new GPS <br>
   * fix has not bee acquired in the expected time frame (as specified <br>
   * by the property PROP_GPS_EXPIRATION). This typically means that <br>
   * either the device is not in an area where a GPS fix is possible, <br>
   * or that there may be a problem with the GPS antenna.
   */
  public static final int ERROR_GPS_EXPIRED = 0xF911;

  /**
   * Contains an error constant signifying a GPS error for when communication is lost with a GPS
   * module (possible module problem). <br>
   * Payload: <br>
   * 0:2 - This error code <br>
   * 2:4 - the time of the last GPS communication <br>
   * 6:X - anything else that the client deems useful to diagnosing this problem. <br>
   * Notes: <br>
   * This differs from ERROR_GPS_EXPIRED is that no communication from <br>
   * GPS module (whether valid, or invalid) has been received in the <br>
   * expected time frame (typically 15 to 30 seconds). This typically <br>
   * indicates a failure in the GPS module.
   */
  public static final int ERROR_GPS_FAILURE = 0xF912;

  // ----------------------------------------------------------------------------
  // Internal errors (data provides specifics):

  /**
   * Contains an error constant signifying an internal error for an error as defined by client
   * device. <br>
   * Payload: <br>
   * 0:2 - This error code <br>
   * 2:X - payload format is defined by the client. <br>
   * Notes: <br>
   * These error codes are for use by the client to allow general <br>
   * error information to be sent to the server for analysis.
   */
  public static final int ERROR_INTERNAL_ERROR_00 = 0xFE00;

  /**
   * Contains an error constant signifying an internal error for an error as defined by client
   * device. <br>
   * Payload: <br>
   * 0:2 - This error code <br>
   * 2:X - payload format is defined by the client. <br>
   * Notes: <br>
   * These error codes are for use by the client to allow general <br>
   * error information to be sent to the server for analysis.
   */
  public static final int ERROR_INTERNAL_ERROR_0F = 0xFE0F;

}
